home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-24 | 3.5 KB | 117 lines | [TEXT/MPS ] |
- // Copyright © 1994-95 by Apple Computer, Inc. All rights reserved.
- // PatternMenu.h
-
- #ifndef __PATTERNMENU__
- #define __PATTERNMENU__
-
- #ifndef __UVIEW__
- #include <UView.h>
- #endif
-
- #ifndef __UTEAROFFMENUVIEW__
- #include "UTearOffMenuView.h"
- #endif
-
- //--------------------------------------------------------------------------------------------------
- // Constants
-
- // Patterns custom pulldown menu, menu drawing placement parameters
-
- #define kPatternsAcross 4
- #define kPatternsDown 10
- const short kTotalPatterns = kPatternsAcross * kPatternsDown;
-
- #define kWPatternsCell 18
- #define kHPatternsCell 14
-
- #define kFrameWidth 1
- const short kHorizontalFrames = kPatternsDown - 1;
- const short kVerticalFrames = kPatternsAcross - 1;
- const short kTotalFrames = kHorizontalFrames * kVerticalFrames;
-
- const short kWPatternsChoice = kWPatternsCell * kPatternsAcross + kVerticalFrames;
- const short kHPatternsChoice = kHPatternsCell * kPatternsDown + kHorizontalFrames;
-
- const short kNoPatternSelection = -1;
-
- //--------------------------------------------------------------------------------------------------
-
- void InitPatternsMenu();
- // Initialize the global array of patterns.
-
- //--------------------------------------------------------------------------------------------------
- // CLASS TPatternsMenu - the patterns tear-off menu
- //--------------------------------------------------------------------------------------------------
- class TPatternsMenu : public TTearOffMenuView
- {
- MA_DECLARE_CLASS;
-
- public:
- TPatternsMenu(); // Constructor
- void IPatternsMenu(ResNumber menuID);
- };
-
- //--------------------------------------------------------------------------------------------------
- // CLASS TPatternsPalette - the patterns palette used in the tools tear-off menu and
- // the tools floating window
- //--------------------------------------------------------------------------------------------------
- class TPatternsPalette : public TView
- {
- MA_DECLARE_CLASS;
-
- public:
- TPatternsPalette(); // Constructor
- void IPatternsPalette(TView* itsSuperView);
-
- virtual void DoPostCreate(TDocument* itsDocument); // Override
-
- void BuildChoiceArray();
- void BuildFramesArray();
-
- // • Screen display
- virtual void DoHighlightSelection(HLState fromHL, HLState toHL); // Override
- virtual void DoSetCursor(const VPoint& localPoint, RgnHandle cursorRegion); // Override
- virtual void Draw(const VRect& area); // Override
-
- void FrameCurrPattern();
- // Frame the currently selected pattern
-
- void SelectNewPattern(short whichPattern);
-
- // • Mousing
- virtual void DoMouseCommand(VPoint& theMouse,
- TToolboxEvent* event,
- CPoint hysteresis); // Override
- virtual void TrackFeedback(TrackPhase aTrackPhase,
- const VPoint& anchorPoint,
- const VPoint& previousPoint,
- const VPoint& nextPoint,
- Boolean mouseDidMove,
- Boolean turnItOn); // Override
-
- short fSelectedPattern;
- short fCurrPattern;
- short fOldPattern;
-
- private:
- CRect fChoiceArray[kTotalPatterns]; // the rectangle in the view containing a Pattern
- CRect fFramesArray[kTotalFrames]; // the frames in the patterns palette
-
- void TurnOffPattern(CRect patternRect, short whichPattern);
- void TurnOnPattern(CRect patternRect, short whichPattern);
- };
-
- //----------------------------------------------------------------------------------------
-
- short RandomPattern();
-
- //----------------------------------------------------------------------------------------
- // Externals
-
- extern Pattern gPat[kTotalPatterns]; // array of Patterns
-
- extern TPatternsMenu* gPatternsMenu;
- extern TWindow* gPatternsWindow;
-
- #endif
-